﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class JinShengModel
    {
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private bool isselected = false;
        [DataMember]
        public bool IsSelected
        {
            get { return isselected; }
            set { isselected = value; }
        }
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }

        private string _KeShi = string.Empty;
        [DataMember]
        public string KeShi
        {
            get { return _KeShi; }
            set { _KeShi = value; }
        }
        private string _ZhiWei = string.Empty;
        [DataMember]
        public string ZhiWei
        {
            get { return _ZhiWei; }
            set { _ZhiWei = value; }
        }
        private string _ZWSX = string.Empty;
        [DataMember]
        public string ZWSX
        {
            get { return _ZWSX; }
            set { _ZWSX = value; }
        }
        private string _ZWCC = string.Empty;
        [DataMember]
        public string ZWCC
        {
            get { return _ZWCC; }
            set { _ZWCC = value; }
        }
        private string _WHCD = string.Empty;
        [DataMember]
        public string WHCD
        {
            get { return _WHCD; }
            set { _WHCD = value; }
        }
        private string _ZZMM = string.Empty;
        [DataMember]
        public string ZZMM
        {
            get { return _ZZMM; }
            set { _ZZMM = value; }
        }
        private string _JSFS = string.Empty;
        [DataMember]
        public string JSFS
        {
            get { return _JSFS; }
            set { _JSFS = value; }
        }
        private string _Demo = string.Empty;
        [DataMember]
        public string Demo
        {
            get { return _Demo; }
            set { _Demo = value; }
        }
        private int _Status;
        [DataMember]
        public int Status
        {
            get { return _Status; }
            set { _Status = value; }
        }
        private string _StatusString = string.Empty;
        [DataMember]
        public string StatusString
        {
            get { return _StatusString; }
            set { _StatusString = value; }
        }
        private string _EmpName = string.Empty;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }

        private string _OrgName = string.Empty;
        [DataMember]
        public string OrgName
        {
            get { return _OrgName; }
            set { _OrgName = value; }
        }
        public static JinShengModel FillEntity(DataRow dr)
        {
            JinShengModel right = new JinShengModel();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) if (!string.IsNullOrEmpty(dr["Sec"].ToString())) right.Sec = Convert.ToInt32(dr["Sec"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ID")) if (!string.IsNullOrEmpty(dr["ID"].ToString())) right.ID = (int)dr["ID"];
            if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) if (!string.IsNullOrEmpty(dr["OrgID"].ToString())) right.OrgID = Convert.ToInt32(dr["OrgID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("KeShi")) right.KeShi = dr["KeShi"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZhiWei")) right.ZhiWei = dr["ZhiWei"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZWSX")) right.ZWSX = dr["ZWSX"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZWCC")) right.ZWCC = dr["ZWCC"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("WHCD")) right.WHCD = dr["WHCD"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZZMM")) right.ZZMM = dr["ZZMM"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("JSFS")) right.JSFS = dr["JSFS"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("Demo")) right.Demo = dr["Demo"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("EmpName")) right.EmpName = dr["EmpName"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("OrgName")) right.OrgName = dr["OrgName"] as string;
            switch (right.Status)
                {
                    case 0:
                        right.StatusString = "未提交";
                        break;
                    case 1:
                        right.StatusString = "已提交";
                        break;
                    case 2:
                        right.StatusString = "已退回";
                        break;
                    case 3:
                        right.StatusString = "已审核";
                        break;
                }
            return right;
        }
    }
}
